package demo1;

class MyThread1 extends Thread{
    @Override
    public void run() {
        while (true){
            System.out.println("my Thread1");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
class MyThread2 extends Thread{
    @Override
    public void run() {
        while (true){
            System.out.println("my Thread2");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class Test1 {
    public static void main(String[] args) {
          MyThread1 thread1 = new MyThread1();
          thread1.start();
          MyThread2 thread2 = new MyThread2();
          thread2.start();
        while (true){
            System.out.println("my main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }


    }
}
